package com.ikun.admin.modules.gen.controller;


import com.ikun.admin.common.annotation.OperationAnno;
import com.ikun.admin.modules.gen.entity.FieldType;
import com.ikun.admin.modules.gen.iservice.ICustomGenerateCodeService;
import com.ikun.admin.modules.gen.vo.CreateTableAndCodeParamVo;
import com.ikun.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @ClassName GenerateCodeController
 * @Description:
 * @CreateDate: 2024/4/13 16:15
 */
@RestController
@RequestMapping("/develop/generateCode")
@Api(tags = "代码生成接口")
public class GenerateCodeController {
    @Autowired
    private ICustomGenerateCodeService icustomGenerateCodeService;

    @PostMapping("/generate")
    @ApiOperation("建表和代码生成接口")
    public Result<String> generate(@RequestBody CreateTableAndCodeParamVo createTableAndCodeParamVo) {
        return icustomGenerateCodeService.generateTableAndCode(createTableAndCodeParamVo);
    }

    @PostMapping("/generate/code")
    @ApiOperation("生成代码接口")
    public Result<String> generateCode(@RequestBody List<Long> tableIdList) {
        return icustomGenerateCodeService.generateCode(tableIdList);
    }
}
